﻿#ifndef DESIGNBLL_H
#define DESIGNBLL_H

#include <QAbstractListModel>
#include <QObject>
#include <QQmlContext>
#include "DesignModel.h" //类必须继承与QObject

#ifdef Q_OS_WIN32
#include "KeyCapturer.h"
#endif

class DesignBLL : public QAbstractListModel
{
    Q_OBJECT
public:
    QList<QObject *> dataList; //作用等同与ListModel
    DesignBLL(int keyMode, QObject *parent = NULL);

private:
    int m_keyMode;
    void onDataListChanged(DesignModel *model);
    // QAbstractItemModel interface
public:
    void monitorDataListChanged(DesignModel *model);
    int rowCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    bool setData(const QModelIndex &index, const QVariant &value, int role);
    QHash<int, QByteArray> roleNames() const;
    Q_INVOKABLE void append();
    Q_INVOKABLE void remove(int index);
};
#endif // DESIGNBLL_H
